package Lambda.Predicate;

import java.util.function.Predicate;

//Predicate函数式接口:适用于判断
public class Predicatedemo1 {
           /* public interface Predicate<T> {//Predicate<T>参数是泛型，返回值是boolean类型
                    boolean test(T t);*/
    private static boolean method(String a, Predicate<String> p1){
        return p1.test(a);
    }

    public static void main(String[] args) {
        String a="abcdef";
        String b="acb";
        /*boolean s=method(a,(String f)->{
            return f.length()<b.length();
        });*/
        //优化后的lambda表达式
        boolean s=method(a,f->f.length()<b.length());
        System.out.println(s);
    }
}
